package org.next.tesigiulia.models;

import org.next.tesigiulia.utils.MyEventBus;

import javax.swing.border.Border;
import java.util.ArrayList;

public class AreasModel {

    private boolean txtAreaEnabled;
    private boolean txtLongitudeEnabled;
    private boolean txtLatitudeEnabled;
    private boolean barRaggioEnabled;

    private boolean lblAreaEnabled;
    private boolean lblLongitudeEnabled;
    private boolean lblLatitudeEnabled;
    private boolean lblRaggioEnabled;

    private boolean btnAdd2Enabled;
    private boolean btnModificaEnabled;
    private boolean btnElininaEnabled;
    private boolean btnClearEnabled;
    private boolean btnAddEnabled;
    private boolean btnAnnullaEnabled;

    private boolean pannelloInfoVisile;
    private boolean btnApplyEnabled;

    private ArrayList<Area> areas = new ArrayList<Area>();
    private Area currentArea = new Area();

    private int selectedIndex;
    private Border txtAreaBorderColorEnabled;
    private Border txtLatitudineBorderColorEnabled;
    private Border txtLongitudineBorderColorEnabled;
    private boolean frameAreeVisibile;
    private boolean listEnabled;


    public void add(Area area) {
        areas.add(area);
        MyEventBus.getInstance().getEventBus().post(areas);
    }

    public void remove(int index) {
        areas.remove(index);
        MyEventBus.getInstance().getEventBus().post(areas);
    }

    public int size() {
        return areas.size();
    }

    public Area get(int index) {
        return areas.get(index);
    }

    public Area getCurrentArea() {
        return currentArea;
    }


    public void setBtnClearEnabled(boolean btnClearEnabled) {
        this.btnClearEnabled = btnClearEnabled;
        MyEventBus.getInstance().getEventBus().post(this);
    }

    public void setBtnAddEnabled(boolean btnAddEnabled) {
        this.btnAddEnabled = btnAddEnabled;
        MyEventBus.getInstance().getEventBus().post(this);
    }


    public void setBtnAnnullaEnabled(boolean btnAnnullaEnabled) {
        this.btnAnnullaEnabled = btnAnnullaEnabled;
        MyEventBus.getInstance().getEventBus().post(this);
    }


    public void setTxtAreaEnabled(boolean txtAreaEnabled) {
        this.txtAreaEnabled = txtAreaEnabled;
        MyEventBus.getInstance().getEventBus().post(this);
    }

    public void setTxtLongitudeEnabled(boolean txtLongitudeEnabled) {
        this.txtLongitudeEnabled = txtLongitudeEnabled;
        MyEventBus.getInstance().getEventBus().post(this);
    }

    public void setTxtLatitudeEnabled(boolean txtLatitudeEnabled) {
        this.txtLatitudeEnabled = txtLatitudeEnabled;
        MyEventBus.getInstance().getEventBus().post(this);
    }

    public void setBarRaggioEnabled(boolean barRaggioEnabled) {
        this.barRaggioEnabled = barRaggioEnabled;
        MyEventBus.getInstance().getEventBus().post(this);
    }

    public void setLblLongitudeEnabled(boolean lblLongitudeEnabled) {
        this.lblLongitudeEnabled = lblLongitudeEnabled;
        MyEventBus.getInstance().getEventBus().post(this);
    }

    public void setLblLatitudeEnabled(boolean lblLatitudeEnabled) {
        this.lblLatitudeEnabled = lblLatitudeEnabled;
        MyEventBus.getInstance().getEventBus().post(this);
    }

    public void setLblRaggioEnabled(boolean lblRaggioEnabled) {
        this.lblRaggioEnabled = lblRaggioEnabled;
        MyEventBus.getInstance().getEventBus().post(this);
    }

    public void setBtnAdd2Enabled(boolean btnAdd2Enabled) {
        this.btnAdd2Enabled = btnAdd2Enabled;
        MyEventBus.getInstance().getEventBus().post(this);
    }

    public void setBtnModificaEnabled(boolean btnModificaEnabled) {
        this.btnModificaEnabled = btnModificaEnabled;
        MyEventBus.getInstance().getEventBus().post(this);
    }

    public void setBtnElininaEnabled(boolean btnElininaEnabled) {
        this.btnElininaEnabled = btnElininaEnabled;
        MyEventBus.getInstance().getEventBus().post(this);
    }

    public void setLblAreaEnabled(boolean lblAreaEnabled) {
        this.lblAreaEnabled = lblAreaEnabled;
        MyEventBus.getInstance().getEventBus().post(this);
    }

    public boolean isBtnClearEnabled() {
        return btnClearEnabled;
    }

    public boolean isBtnAddEnabled() {
        return btnAddEnabled;
    }

    public boolean isBtnAnnullaEnabled() {
        return btnAnnullaEnabled;
    }

    public boolean isTxtAreaEnabled() {
        return txtAreaEnabled;
    }

    public boolean isTxtLongitudeEnabled() {
        return txtLongitudeEnabled;
    }

    public boolean isBarRaggioEnabled() {
        return barRaggioEnabled;
    }

    public boolean isTxtLatitudeEnabled() {
        return txtLatitudeEnabled;
    }

    public boolean isLblAreaEnabled() {
        return lblAreaEnabled;
    }

    public boolean isLblLatitudeEnabled() {
        return lblLatitudeEnabled;
    }

    public boolean isLblRaggioEnabled() {
        return lblRaggioEnabled;
    }

    public boolean isLblLongitudeEnabled() {
        return lblLongitudeEnabled;
    }

    public boolean isBtnModificaEnabled() {
        return btnModificaEnabled;
    }

    public boolean isBtnAdd2Enabled() {
        return btnAdd2Enabled;
    }

    public boolean isBtnElininaEnabled() {
        return btnElininaEnabled;
    }

    public void setPannelloInfoVisile(boolean pannelloInfoVisile) {
        this.pannelloInfoVisile = pannelloInfoVisile;
        MyEventBus.getInstance().getEventBus().post(this);
    }

    public boolean isPannelloInfoVisile() {
        return pannelloInfoVisile;
    }

    public void setBtnApplyEnabled(boolean btnApplyEnabled) {
        this.btnApplyEnabled = btnApplyEnabled;
    }

    public boolean isBtnApplyEnabled() {
        return btnApplyEnabled;
    }

    public void setCurrentArea(Area currentArea) {
        this.currentArea = currentArea;
        MyEventBus.getInstance().getEventBus().post(currentArea);
    }

    public void set(int idx, Area area) {
        this.areas.set(idx, area);
    }

    public void setTxtAreaBorderColorEnabled(Border txtAreaBorderColorEnabled) {
        this.txtAreaBorderColorEnabled = txtAreaBorderColorEnabled;
        MyEventBus.getInstance().getEventBus().post(this);
    }

    public Border getTxtAreaBorderColorEnabled() {
        return txtAreaBorderColorEnabled;
    }

    public Border getTxtLatitudineBorderColorEnabled() {
        return txtLatitudineBorderColorEnabled;
    }

    public void setTxtLatitudineBorderColorEnabled(Border txtLatitudineBorderColorEnabled) {
        this.txtLatitudineBorderColorEnabled = txtLatitudineBorderColorEnabled;
        MyEventBus.getInstance().getEventBus().post(this);
    }

    public Border getTxtLongitudineBorderColorEnabled() {
        return txtLongitudineBorderColorEnabled;
    }

    public void setTxtLongitudineBorderColorEnabled(Border txtLongitudineBorderColorEnabled) {
        this.txtLongitudineBorderColorEnabled = txtLongitudineBorderColorEnabled;
        MyEventBus.getInstance().getEventBus().post(this);
    }

    public boolean isJframeVisible() {
        return frameAreeVisibile;
    }


    public void setJframeVisible(boolean b) {
        this.frameAreeVisibile = b;
        MyEventBus.getInstance().getEventBus().post(this);
    }

    public void setJlistEnabled(boolean b) {

        this.listEnabled = b;
        MyEventBus.getInstance().getEventBus().post(this);
    }

    public boolean isListEnabled() {
        return listEnabled;
    }
}

